<%@ page language="java" contentType="application/vnd.ms-excel; name='member'; charset=UTF-8" pageEncoding="UTF-8"  import="java.util.*,common.*,java.sql.*,db.*"%>
<%
response.setHeader("Content-Disposition", "inline; filename=member.xls"); // 파일 이름 지정
response.setHeader("Content-Description", "JSP Generated Data");
%>    
<%
request.setCharacterEncoding("utf-8");

String member_id 		= "";
String login_id_map 		= "";
String login_name 	= "";
String soc_no 		= "";
String email 	= "";
String tel_no	= "";
String cell_no	= "";
String ent_nm	= "";
String reg_dt	= "";
String addr	= "";
String detail_addr	= "";
String post_no	= "";
String etc	= "";
String r_num="";
        
        UserSession userSession = (UserSession)session.getAttribute("user"); 
		
		String admin_level = null;
		String ent_id = CommonUtil.nvl(request.getParameter("ent_id"));
		
		if(userSession!= null){
			admin_level = userSession.getAdmin_level();
			if(ent_id.equals("") && admin_level.equals("5") ){
				ent_id = userSession.getEnt_id();
			}
		}
		
		String user_id = CommonUtil.nvl(request.getParameter("user_id"));
		
		
		String search_combo = CommonUtil.nvl(request.getParameter("search_combo"));
		String keyword = CommonUtil.nvl(request.getParameter("keyword"));
		String total_count = CommonUtil.nvl(request.getParameter("total_count"),"0");
		String curr_page = CommonUtil.nvl(request.getParameter("curr_page"),"1");

        String[] param = new String[7];
		param[0] = user_id;	
		param[1] = search_combo;	
		param[2] = keyword;	
		param[3] = total_count;	
		param[4] = total_count;	
		param[5] = "1";	
		param[6] = ent_id;
		
		Connection con=null;
		ArrayList list =null;
		HashMap listMap = new HashMap();	
		
		try {	
			con = (new CommonConnect()).getConnection_ds1();			
			
			String queryStr = "call sp_sp0601_list(?,?,?,?,?,?,?)";	
			list = DAO.select(con,queryStr,param);	
			
			
		} catch (Exception e) {
			e.printStackTrace();
		}finally {
			  try{
				  if (con!=null) con.close();
			  }catch(Exception ee){}
		}
		
		
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Excel Download</title>
</head>
<body>
<form name="excel_frm">
<b></b>
</BR>
</BR>
<table width="760" border="1" cellpadding="2" cellspacing="0" bordercolor="C0C0C0" bordercolordark="#FFFFFF" frame=below >
	<tr height="23">
		<td width="50" bgcolor="#D3EBD7" align="center"> 번호 </td>
		<td width="160" bgcolor="#D3EBD7" align="center"> 소속 </td>
		<td width="160" bgcolor="#D3EBD7" align="center"> 이름 </td>
		<td width="160" bgcolor="#D3EBD7" align="center"> 아이디 </td>
	    <td width="200" bgcolor="#D3EBD7" align="center"> 주민번호 </td>
	    <td width="160" bgcolor="#D3EBD7" align="center"> 연락처 </td>
	    <td width="160" bgcolor="#D3EBD7" align="center"> 핸드폰 </td>
		<td width="160" bgcolor="#D3EBD7" align="center"> 이메일 </td>
		<td width="400" bgcolor="#D3EBD7" align="center"> 등록일 </td>
	</tr>
	<% for (int i=0; i< list.size(); i++) {
		  listMap=(HashMap)list.get(i);
		        
		  r_num = CommonUtil.nvl((String)listMap.get("r_num"));
		  member_id = CommonUtil.nvl((String)listMap.get("member_id"));
	      
		  ent_nm = CommonUtil.nvl((String)listMap.get("ent_nm"));
		  login_id_map = CommonUtil.nvl(Crypto.DecodeBySType((String)listMap.get("login_id")));
	      
		  login_name = CommonUtil.nvl((String)listMap.get("login_name"));
	      
		  soc_no = CommonUtil.nvl(Crypto.DecodeBySType((String)listMap.get("soc_no")));
		  email = CommonUtil.nvl((String)listMap.get("email"));
		  tel_no = CommonUtil.nvl((String)listMap.get("tel_no"));
		  cell_no = CommonUtil.nvl((String)listMap.get("cell_no"));
	      reg_dt = CommonUtil.nvl((String)listMap.get("reg_dt"));
	%>
	<tr height="23">
		<td align="center"> <%= r_num %> </td>
	    <td align="center"> <%= ent_nm %> </td>
	    <td align="center"> <%= login_name %> </td>
	    <td align="center"> <%= login_id_map%> </td>
	    <td align="center"> <%= soc_no%> </td>
	    <td align="center"> <%= tel_no %> </td>
	    <td align="center"> <%= cell_no %> </td>
	    <td align="center"> <%= email %> </td>		
		<td align="center"> <%= reg_dt %> </td>
		
	</tr>
	<% }%>
</table>
</form>
</body>
</html>
